//
//  String+version.swift
//  OnemeetingDemo
//
//  Created by 张衡 on 2019/12/6.
//  Copyright © 2019 www.onemeeting.1meetingIos. All rights reserved.
//

import Foundation

extension String {
    func ck_compare(with version: String) -> ComparisonResult {
        return compare(version, options: .numeric, range: nil, locale: nil)
    }
    
    func isNewer(than aVersionString: String) -> Bool {
        return ck_compare(with: aVersionString) == .orderedDescending
    }
    
    func isOlder(than aVersionString: String) -> Bool {
        return ck_compare(with: aVersionString) == .orderedAscending
    }
    
    func isSame(to aVersionString: String) -> Bool {
        return ck_compare(with: aVersionString) == .orderedSame
    }
}
